#pragma once
#include "../Utilities/utilities.h"
#define LIMIT_VIEW_ROTATE_X 0.3f

class CCamera
{
protected:
	static CCamera* s_Instance;

	CCamera();
	CCamera(const CCamera &){}
	CCamera& operator =(const CCamera &){}
	virtual ~CCamera();

	Matrix m_maView;
	Matrix m_maviewSky;
	Matrix m_maProjection;

	void MoveForward(const float &delta);
	void MoveBack(const float &delta);
	void MoveLeft(const float &delta);
	void MoveRight(const float &delta);
	void MoveUp(const float &delta);
	void MoveDown(const float &delta);

public:
	// Methods
	Matrix GetViewMatrix();
	Matrix GetProjectionMatrix();
	Matrix GetViewProjectionMatrix();
	Matrix GetViewMatrixSky();

	Vector3 GetXAxis();
	Vector3 GetYAxis();
	Vector3 GetZAxis();

	void Update(const float &deltaTime);
	void Reset();
	
	Matrix ComputeViewMatrix();
	Matrix ComputeWorldMatrix();


	void MoveForward();
	void MoveBack();
	void MoveLeft();
	void MoveRight();
	void MoveUp();
	void MoveDown();

	void RotateX(float &angle);
	void RotateY(float &angle);

	// Static methods
	static CCamera* GetInstance();
	static void DetroyInstance();

	// Propertices
	Vector3 m_v3CamPos;
	Vector3 m_vUp;
	Vector3 m_v3Target;
	float m_fSpeed;
	
	float m_fNear, m_fFar;
};
